Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/CyclicAssumption.java @ 22010:f410818cdec8
add missing truffle boundaries
author | Andreas Woess <andreas.woess@oracle.com> |
---|---|
date | Thu, 23 Jul 2015 16:28:48 +0200 |
parents | 9c8c0937da41 |
children | dc83cc1f94f2 |
comparison
equal
deleted
inserted
replaced
22009:130e5f69d1a6 | 22010:f410818cdec8 |
---|---|
25 package com.oracle.truffle.api.utilities; | 25 package com.oracle.truffle.api.utilities; |
26 | 26 |
27 import java.util.concurrent.atomic.*; | 27 import java.util.concurrent.atomic.*; |
28 | 28 |
29 import com.oracle.truffle.api.*; | 29 import com.oracle.truffle.api.*; |
30 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; | |
30 | 31 |
31 /** | 32 /** |
32 * Holds an {@link Assumption}, and knows how to recreate it with the same properties on | 33 * Holds an {@link Assumption}, and knows how to recreate it with the same properties on |
33 * invalidation. Used so that mutability is isolated in this class, and all other classes that need | 34 * invalidation. Used so that mutability is isolated in this class, and all other classes that need |
34 * an assumption that may be recreated can have a final reference to an object of this class. Note | 35 * an assumption that may be recreated can have a final reference to an object of this class. Note |
43 public CyclicAssumption(String name) { | 44 public CyclicAssumption(String name) { |
44 this.name = name; | 45 this.name = name; |
45 this.assumption = new AtomicReference<>(Truffle.getRuntime().createAssumption(name)); | 46 this.assumption = new AtomicReference<>(Truffle.getRuntime().createAssumption(name)); |
46 } | 47 } |
47 | 48 |
49 @TruffleBoundary | |
48 public void invalidate() { | 50 public void invalidate() { |
49 Assumption newAssumption = Truffle.getRuntime().createAssumption(name); | 51 Assumption newAssumption = Truffle.getRuntime().createAssumption(name); |
50 Assumption oldAssumption = assumption.getAndSet(newAssumption); | 52 Assumption oldAssumption = assumption.getAndSet(newAssumption); |
51 oldAssumption.invalidate(); | 53 oldAssumption.invalidate(); |
52 } | 54 } |