Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/BranchProfile.java @ 18510:cb4d5cc2b52b
Truffle: clone ConditionProfile and BranchProfile node fields
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Tue, 25 Nov 2014 13:21:50 +0100 |
parents | 87ea195b66ff |
children | 62aac33db669 |
comparison
equal
deleted
inserted
replaced
18509:7bf2965140de | 18510:cb4d5cc2b52b |
---|---|
24 */ | 24 */ |
25 package com.oracle.truffle.api.utilities; | 25 package com.oracle.truffle.api.utilities; |
26 | 26 |
27 import com.oracle.truffle.api.*; | 27 import com.oracle.truffle.api.*; |
28 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; | 28 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; |
29 import com.oracle.truffle.api.nodes.*; | |
29 | 30 |
30 /** | 31 /** |
31 * Utility class to speculate on branches to be never visited. If the {@link #enter()} method is | 32 * Utility class to speculate on branches to be never visited. If the {@link #enter()} method is |
32 * invoked first the optimized code is invalidated and the branch where {@link #enter()} is invoked | 33 * invoked first the optimized code is invalidated and the branch where {@link #enter()} is invoked |
33 * is enabled for compilation. Otherwise if the {@link #enter()} method was never invoked the branch | 34 * is enabled for compilation. Otherwise if the {@link #enter()} method was never invoked the branch |
34 * will not get compiled. | 35 * will not get compiled. |
35 * | 36 * |
36 * All {@code BranchProfile} instances must be held in {@code final} fields for compiler | 37 * All {@code BranchProfile} instances must be held in {@code final} fields for compiler |
37 * optimizations to take effect. | 38 * optimizations to take effect. |
38 */ | 39 */ |
39 public final class BranchProfile { | 40 public final class BranchProfile implements NodeCloneable { |
40 | 41 |
41 @CompilationFinal private boolean visited; | 42 @CompilationFinal private boolean visited; |
42 | 43 |
43 private BranchProfile() { | 44 private BranchProfile() { |
44 } | 45 } |
61 @Override | 62 @Override |
62 public String toString() { | 63 public String toString() { |
63 return String.format("%s(%s)@%x", getClass().getSimpleName(), visited ? "visited" : "not-visited", hashCode()); | 64 return String.format("%s(%s)@%x", getClass().getSimpleName(), visited ? "visited" : "not-visited", hashCode()); |
64 } | 65 } |
65 | 66 |
67 @Override | |
68 public Object clone() { | |
69 try { | |
70 return super.clone(); | |
71 } catch (CloneNotSupportedException e) { | |
72 throw new AssertionError(e); | |
73 } | |
74 } | |
66 } | 75 } |