Mercurial > hg > truffle
annotate truffle/com.oracle.truffle.api.profiles/src/com/oracle/truffle/api/profiles/BranchProfile.java @ 22526:a5e58793bbca
BranchProfile Javadoc sample was uncompilable. Fixed with the help of codesnippet tag.
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Wed, 30 Dec 2015 11:06:33 +0100 |
parents | d80a5ff56f51 |
children |
rev | line source |
---|---|
13335
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
1 /* |
22501
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
2 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. |
13335
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
4 * |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. Oracle designates this |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
8 * particular file as subject to the "Classpath" exception as provided |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
9 * by Oracle in the LICENSE file that accompanied this code. |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
10 * |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
15 * accompanied this code). |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
16 * |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU General Public License version |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
20 * |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
22 * or visit www.oracle.com if you need additional information or have any |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
23 * questions. |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
24 */ |
22501
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
25 package com.oracle.truffle.api.profiles; |
13335
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.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.CompilerDirectives; |
14991
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
13335
diff
changeset
|
28 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; |
13335
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
29 |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
30 /** |
22501
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
31 * <p> |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
32 * BranchProfiles are profiles to speculate on branches that are unlikely to be visited. If the |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
33 * {@link #enter()} method is invoked first the optimized code is invalidated and the branch where |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
34 * {@link #enter()} is invoked is enabled for compilation. Otherwise if the {@link #enter()} method |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
35 * was never invoked the branch will not get compiled. |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
36 * </p> |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
37 * |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
38 * <p> |
22526
a5e58793bbca
BranchProfile Javadoc sample was uncompilable. Fixed with the help of codesnippet tag.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22504
diff
changeset
|
39 * <b> Usage example: </b> {@codesnippet BranchProfileSample} |
22501
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
40 * |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
41 * {@inheritDoc} |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
42 * |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
43 * @see BranchProfile#enter() |
13335
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
44 */ |
22501
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
45 public abstract class BranchProfile extends Profile { |
13335
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
46 |
22501
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
47 BranchProfile() { |
17421
87ea195b66ff
Truffle: Make BranchProfile constructor private and introduce a factory Method BranchProfile.create().
Christian Humer <christian.humer@gmail.com>
parents:
16868
diff
changeset
|
48 } |
87ea195b66ff
Truffle: Make BranchProfile constructor private and introduce a factory Method BranchProfile.create().
Christian Humer <christian.humer@gmail.com>
parents:
16868
diff
changeset
|
49 |
22501
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
50 /** |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
51 * Call when an unlikely branch is entered. |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
52 */ |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
53 public abstract void enter(); |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
54 |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
55 /** |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
56 * @deprecated it is not reliable when profiling is turned off. |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
57 */ |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
58 @Deprecated |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
59 public abstract boolean isVisited(); |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
60 |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
61 /** |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
62 * Call to create a new instance of a branch profile. |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
63 */ |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
64 public static BranchProfile create() { |
22504
d80a5ff56f51
Storing the profiling enabled information in a static field; checking it only once; shielding against missing method in the TruffleRuntime interface
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22503
diff
changeset
|
65 if (Profile.isProfilingEnabled()) { |
22501
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
66 return Enabled.create0(); |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
67 } else { |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
68 return Disabled.INSTANCE; |
13335
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
69 } |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
70 } |
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
71 |
22501
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
72 static final class Enabled extends BranchProfile { |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
73 |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
74 @CompilationFinal private boolean visited; |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
75 |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
76 @Override |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
77 public void enter() { |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
78 if (!visited) { |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
79 CompilerDirectives.transferToInterpreterAndInvalidate(); |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
80 visited = true; |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
81 } |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
82 } |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
83 |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
84 @SuppressWarnings("deprecation") |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
85 @Override |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
86 public boolean isVisited() { |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
87 return visited; |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
88 } |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
89 |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
90 @Override |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
91 public String toString() { |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
92 return toString(BranchProfile.class, !visited, false, "VISITED"); |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
93 } |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
94 |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
95 /* Needed for lazy class loading. */ |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
96 static BranchProfile create0() { |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
97 return new Enabled(); |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
98 } |
16747
d9d496d77d37
Truffle: Added option to query a BranchProfile for visited.
Christian Humer <christian.humer@gmail.com>
parents:
14992
diff
changeset
|
99 } |
d9d496d77d37
Truffle: Added option to query a BranchProfile for visited.
Christian Humer <christian.humer@gmail.com>
parents:
14992
diff
changeset
|
100 |
22501
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
101 static final class Disabled extends BranchProfile { |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
102 |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
103 static final BranchProfile INSTANCE = new Disabled(); |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
104 |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
105 @Override |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
106 protected Object clone() { |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
107 return INSTANCE; |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
108 } |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
109 |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
110 @Override |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
111 public void enter() { |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
112 } |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
113 |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
114 @SuppressWarnings("deprecation") |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
115 @Override |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
116 public boolean isVisited() { |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
117 return true; |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
118 } |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
119 |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
120 @Override |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
121 public String toString() { |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
122 return toStringDisabled(BranchProfile.class); |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
123 } |
a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
Christian Humer <christian.humer@oracle.com>
parents:
22157
diff
changeset
|
124 |
17421
87ea195b66ff
Truffle: Make BranchProfile constructor private and introduce a factory Method BranchProfile.create().
Christian Humer <christian.humer@gmail.com>
parents:
16868
diff
changeset
|
125 } |
87ea195b66ff
Truffle: Make BranchProfile constructor private and introduce a factory Method BranchProfile.create().
Christian Humer <christian.humer@gmail.com>
parents:
16868
diff
changeset
|
126 |
13335
8531c47138dc
Truffle: introduced new profiling utility BranchProfile.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
127 } |