annotate graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugValue.java @ 21794:483b357016a6

Use export target explicitly in mx_graal.py when building JDK (JBS:GRAAL-52)
author Stefan Anzinger <stefan.anzinger@oracle.com>
date Mon, 08 Jun 2015 20:30:39 +0200
parents b1530a6cce8c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4352
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
1 /*
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
4 *
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
7 * published by the Free Software Foundation.
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
8 *
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
13 * accompanied this code).
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
14 *
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
15 * You should have received a copy of the GNU General Public License version
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
18 *
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
21 * questions.
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
22 */
21554
b1530a6cce8c renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 12778
diff changeset
23 package com.oracle.jvmci.debug.internal;
4349
7e974a026889 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
11364
70e8575d5264 more javadoc for debug framework
Doug Simon <doug.simon@oracle.com>
parents: 7557
diff changeset
25 /**
70e8575d5264 more javadoc for debug framework
Doug Simon <doug.simon@oracle.com>
parents: 7557
diff changeset
26 * A name and index for a value managed in a thread local value map. All access to the value is made
70e8575d5264 more javadoc for debug framework
Doug Simon <doug.simon@oracle.com>
parents: 7557
diff changeset
27 * via a {@link DebugValue} instance.
70e8575d5264 more javadoc for debug framework
Doug Simon <doug.simon@oracle.com>
parents: 7557
diff changeset
28 */
7551
68a59067974a made DebugValue implement Comparable and removed comparator that sorted the "Runs" metric before all others
Doug Simon <doug.simon@oracle.com>
parents: 5386
diff changeset
29 public abstract class DebugValue implements Comparable<DebugValue> {
5386
19e5dc8d0891 alphabetically sort debug values for Metric and Time
Lukas Stadler <lukas.stadler@jku.at>
parents: 5134
diff changeset
30
7557
db90c8b5a861 changed DebugMetric.add() to take a long parameter instead of an int
Doug Simon <doug.simon@oracle.com>
parents: 7553
diff changeset
31 private final String name;
4352
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
32 private int index;
11628
febd01be55e0 moved 'conditional' field and related methods down in DebugValue
Doug Simon <doug.simon@oracle.com>
parents: 11364
diff changeset
33 private boolean conditional;
4352
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
34
11628
febd01be55e0 moved 'conditional' field and related methods down in DebugValue
Doug Simon <doug.simon@oracle.com>
parents: 11364
diff changeset
35 protected DebugValue(String name, boolean conditional) {
4349
7e974a026889 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
36 this.name = name;
4352
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
37 this.index = -1;
11628
febd01be55e0 moved 'conditional' field and related methods down in DebugValue
Doug Simon <doug.simon@oracle.com>
parents: 11364
diff changeset
38 this.conditional = conditional;
4349
7e974a026889 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
39 }
4352
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
40
12778
c125485642e2 added getCurrentValue() to both DebugTimer and DebugValue; added getTimeUnit() to DebugTimer
Doug Simon <doug.simon@oracle.com>
parents: 11628
diff changeset
41 public long getCurrentValue() {
4352
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
42 ensureInitialized();
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
43 return DebugScope.getInstance().getCurrentValue(index);
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
44 }
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
45
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
46 protected void setCurrentValue(long l) {
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
47 ensureInitialized();
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
48 DebugScope.getInstance().setCurrentValue(index, l);
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
49 }
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
50
11628
febd01be55e0 moved 'conditional' field and related methods down in DebugValue
Doug Simon <doug.simon@oracle.com>
parents: 11364
diff changeset
51 public void setConditional(boolean flag) {
febd01be55e0 moved 'conditional' field and related methods down in DebugValue
Doug Simon <doug.simon@oracle.com>
parents: 11364
diff changeset
52 conditional = flag;
febd01be55e0 moved 'conditional' field and related methods down in DebugValue
Doug Simon <doug.simon@oracle.com>
parents: 11364
diff changeset
53 }
febd01be55e0 moved 'conditional' field and related methods down in DebugValue
Doug Simon <doug.simon@oracle.com>
parents: 11364
diff changeset
54
febd01be55e0 moved 'conditional' field and related methods down in DebugValue
Doug Simon <doug.simon@oracle.com>
parents: 11364
diff changeset
55 public boolean isConditional() {
febd01be55e0 moved 'conditional' field and related methods down in DebugValue
Doug Simon <doug.simon@oracle.com>
parents: 11364
diff changeset
56 return conditional;
febd01be55e0 moved 'conditional' field and related methods down in DebugValue
Doug Simon <doug.simon@oracle.com>
parents: 11364
diff changeset
57 }
febd01be55e0 moved 'conditional' field and related methods down in DebugValue
Doug Simon <doug.simon@oracle.com>
parents: 11364
diff changeset
58
4352
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
59 private void ensureInitialized() {
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
60 if (index == -1) {
11364
70e8575d5264 more javadoc for debug framework
Doug Simon <doug.simon@oracle.com>
parents: 7557
diff changeset
61 index = KeyRegistry.register(this);
4352
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
62 }
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
63 }
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
64
7557
db90c8b5a861 changed DebugMetric.add() to take a long parameter instead of an int
Doug Simon <doug.simon@oracle.com>
parents: 7553
diff changeset
65 protected void addToCurrentValue(long value) {
db90c8b5a861 changed DebugMetric.add() to take a long parameter instead of an int
Doug Simon <doug.simon@oracle.com>
parents: 7553
diff changeset
66 setCurrentValue(getCurrentValue() + value);
4352
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
67 }
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
68
11364
70e8575d5264 more javadoc for debug framework
Doug Simon <doug.simon@oracle.com>
parents: 7557
diff changeset
69 /**
70e8575d5264 more javadoc for debug framework
Doug Simon <doug.simon@oracle.com>
parents: 7557
diff changeset
70 * Gets the globally unique index for the value represented by this object.
70e8575d5264 more javadoc for debug framework
Doug Simon <doug.simon@oracle.com>
parents: 7557
diff changeset
71 */
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
72 public int getIndex() {
7557
db90c8b5a861 changed DebugMetric.add() to take a long parameter instead of an int
Doug Simon <doug.simon@oracle.com>
parents: 7553
diff changeset
73 ensureInitialized();
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
74 return index;
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
75 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
76
11364
70e8575d5264 more javadoc for debug framework
Doug Simon <doug.simon@oracle.com>
parents: 7557
diff changeset
77 /**
70e8575d5264 more javadoc for debug framework
Doug Simon <doug.simon@oracle.com>
parents: 7557
diff changeset
78 * Gets the globally unique name for the value represented by this object.
70e8575d5264 more javadoc for debug framework
Doug Simon <doug.simon@oracle.com>
parents: 7557
diff changeset
79 */
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
80 public String getName() {
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
81 return name;
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
82 }
5134
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
83
7551
68a59067974a made DebugValue implement Comparable and removed comparator that sorted the "Runs" metric before all others
Doug Simon <doug.simon@oracle.com>
parents: 5386
diff changeset
84 public int compareTo(DebugValue o) {
68a59067974a made DebugValue implement Comparable and removed comparator that sorted the "Runs" metric before all others
Doug Simon <doug.simon@oracle.com>
parents: 5386
diff changeset
85 return name.compareTo(o.name);
68a59067974a made DebugValue implement Comparable and removed comparator that sorted the "Runs" metric before all others
Doug Simon <doug.simon@oracle.com>
parents: 5386
diff changeset
86 }
68a59067974a made DebugValue implement Comparable and removed comparator that sorted the "Runs" metric before all others
Doug Simon <doug.simon@oracle.com>
parents: 5386
diff changeset
87
7557
db90c8b5a861 changed DebugMetric.add() to take a long parameter instead of an int
Doug Simon <doug.simon@oracle.com>
parents: 7553
diff changeset
88 @Override
db90c8b5a861 changed DebugMetric.add() to take a long parameter instead of an int
Doug Simon <doug.simon@oracle.com>
parents: 7553
diff changeset
89 public String toString() {
db90c8b5a861 changed DebugMetric.add() to take a long parameter instead of an int
Doug Simon <doug.simon@oracle.com>
parents: 7553
diff changeset
90 return name + "@" + index;
db90c8b5a861 changed DebugMetric.add() to take a long parameter instead of an int
Doug Simon <doug.simon@oracle.com>
parents: 7553
diff changeset
91 }
db90c8b5a861 changed DebugMetric.add() to take a long parameter instead of an int
Doug Simon <doug.simon@oracle.com>
parents: 7553
diff changeset
92
5134
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
93 public abstract String toString(long value);
4352
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4349
diff changeset
94 }