diff 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
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/BranchProfile.java	Tue Nov 25 13:21:38 2014 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/BranchProfile.java	Tue Nov 25 13:21:50 2014 +0100
@@ -26,6 +26,7 @@
 
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
+import com.oracle.truffle.api.nodes.*;
 
 /**
  * Utility class to speculate on branches to be never visited. If the {@link #enter()} method is
@@ -36,7 +37,7 @@
  * All {@code BranchProfile} instances must be held in {@code final} fields for compiler
  * optimizations to take effect.
  */
-public final class BranchProfile {
+public final class BranchProfile implements NodeCloneable {
 
     @CompilationFinal private boolean visited;
 
@@ -63,4 +64,12 @@
         return String.format("%s(%s)@%x", getClass().getSimpleName(), visited ? "visited" : "not-visited", hashCode());
     }
 
+    @Override
+    public Object clone() {
+        try {
+            return super.clone();
+        } catch (CloneNotSupportedException e) {
+            throw new AssertionError(e);
+        }
+    }
 }