Java Code Examples for java.lang.invoke.VarHandle#storeStoreFence()
The following examples show how to use
java.lang.invoke.VarHandle#storeStoreFence() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StampedLock.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * If the lock state matches the given stamp, atomically performs one of * the following actions. If the stamp represents holding a write * lock, returns it. Or, if a read lock, if the write lock is * available, releases the read lock and returns a write stamp. * Or, if an optimistic read, returns a write stamp only if * immediately available. This method returns zero in all other * cases. * * @param stamp a stamp * @return a valid write stamp, or zero on failure */ public long tryConvertToWriteLock(long stamp) { long a = stamp & ABITS, m, s, next; while (((s = state) & SBITS) == (stamp & SBITS)) { if ((m = s & ABITS) == 0L) { if (a != 0L) break; if ((next = tryWriteLock(s)) != 0L) return next; } else if (m == WBIT) { if (a != m) break; return stamp; } else if (m == RUNIT && a != 0L) { if (casState(s, next = s - RUNIT + WBIT)) { VarHandle.storeStoreFence(); return next; } } else break; } return 0L; }
Example 2
Source File: VarHandleMarkHolder.java From perfmark with Apache License 2.0 | 5 votes |
@Override public void event(long gen, String eventName, String subEventName, long nanoTime) { long localIdx = (long) IDX.get(this); int i = (int) (localIdx & maxEventsMax); STRINGS.setOpaque(taskNames, i, eventName); STRINGS.setOpaque(tagNames, i, subEventName); LONGS.setOpaque(nanoTimes, i, nanoTime); LONGS.setOpaque(genOps, i, gen + EVENT_S_OP); IDX.setRelease(this, localIdx + 1); VarHandle.storeStoreFence(); }
Example 3
Source File: StampedLock.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private long tryWriteLock(long s) { // assert (s & ABITS) == 0L; long next; if (casState(s, next = s | WBIT)) { VarHandle.storeStoreFence(); return next; } return 0L; }
Example 4
Source File: VarHandleMarkHolder.java From perfmark with Apache License 2.0 | 5 votes |
@Override public void resetForTest() { Arrays.fill(taskNames, null); Arrays.fill(markers, null); Arrays.fill(tagNames, null); Arrays.fill(tagIds, 0); Arrays.fill(nanoTimes, 0); Arrays.fill(genOps, 0); IDX.setRelease(this, 0L); VarHandle.storeStoreFence(); }
Example 5
Source File: VarHandleMarkHolder.java From perfmark with Apache License 2.0 | 5 votes |
@Override public void attachKeyedTag(long gen, String name, String value) { long localIdx = (long) IDX.get(this); int i = (int) (localIdx & maxEventsMax); STRINGS.setOpaque(tagNames, i, name); STRINGS.setOpaque(taskNames, i, value); LONGS.setOpaque(genOps, i, gen + ATTACH_SS_OP); IDX.setRelease(this, localIdx + 1); VarHandle.storeStoreFence(); }
Example 6
Source File: VarHandleMarkHolder.java From perfmark with Apache License 2.0 | 5 votes |
@Override public void attachKeyedTag(long gen, String name, long value0, long value1) { long localIdx = (long) IDX.get(this); int i = (int) (localIdx & maxEventsMax); STRINGS.setOpaque(tagNames, i, name); LONGS.setOpaque(tagIds, i, value0); LONGS.setOpaque(nanoTimes, i, value1); LONGS.setOpaque(genOps, i, gen + ATTACH_SNN_OP); IDX.setRelease(this, localIdx + 1); VarHandle.storeStoreFence(); }
Example 7
Source File: VarHandleMarkHolder.java From perfmark with Apache License 2.0 | 5 votes |
@Override public void attachKeyedTag(long gen, String name, long value) { long localIdx = (long) IDX.get(this); int i = (int) (localIdx & maxEventsMax); STRINGS.setOpaque(tagNames, i, name); LONGS.setOpaque(tagIds, i, value); LONGS.setOpaque(genOps, i, gen + ATTACH_SN_OP); IDX.setRelease(this, localIdx + 1); VarHandle.storeStoreFence(); }
Example 8
Source File: VarHandleMarkHolder.java From perfmark with Apache License 2.0 | 5 votes |
@Override public void attachTag(long gen, String tagName, long tagId) { long localIdx = (long) IDX.get(this); int i = (int) (localIdx & maxEventsMax); STRINGS.setOpaque(tagNames, i, tagName); LONGS.setOpaque(tagIds, i, tagId); LONGS.setOpaque(genOps, i, gen + ATTACH_T_OP); IDX.setRelease(this, localIdx + 1); VarHandle.storeStoreFence(); }
Example 9
Source File: VarHandleMarkHolder.java From perfmark with Apache License 2.0 | 5 votes |
@Override public void start(long gen, String taskName, String tagName, long tagId, long nanoTime) { long localIdx = (long) IDX.get(this); int i = (int) (localIdx & maxEventsMax); STRINGS.setOpaque(taskNames, i, taskName); STRINGS.setOpaque(tagNames, i, tagName); LONGS.setOpaque(tagIds, i, tagId); LONGS.setOpaque(nanoTimes, i, nanoTime); LONGS.setOpaque(genOps, i, gen + START_T_OP); IDX.setRelease(this, localIdx + 1); VarHandle.storeStoreFence(); }
Example 10
Source File: VarHandleMarkHolder.java From perfmark with Apache License 2.0 | 5 votes |
@Override public void event(long gen, String eventName, long nanoTime) { long localIdx = (long) IDX.get(this); int i = (int) (localIdx & maxEventsMax); STRINGS.setOpaque(taskNames, i, eventName); LONGS.setOpaque(nanoTimes, i, nanoTime); LONGS.setOpaque(genOps, i, gen + EVENT_OP); IDX.setRelease(this, localIdx + 1); VarHandle.storeStoreFence(); }
Example 11
Source File: VarHandleMarkHolder.java From perfmark with Apache License 2.0 | 5 votes |
@Override public void event(long gen, String eventName, String tagName, long tagId, long nanoTime) { long localIdx = (long) IDX.get(this); int i = (int) (localIdx & maxEventsMax); STRINGS.setOpaque(taskNames, i, eventName); STRINGS.setOpaque(tagNames, i, tagName); LONGS.setOpaque(tagIds, i, tagId); LONGS.setOpaque(nanoTimes, i, nanoTime); LONGS.setOpaque(genOps, i, gen + EVENT_T_OP); IDX.setRelease(this, localIdx + 1); VarHandle.storeStoreFence(); }
Example 12
Source File: VarHandleMarkHolder.java From perfmark with Apache License 2.0 | 5 votes |
@Override public void stop(long gen, String taskName, String subTaskName, long nanoTime) { long localIdx = (long) IDX.get(this); int i = (int) (localIdx & maxEventsMax); STRINGS.setOpaque(taskNames, i, taskName); STRINGS.setOpaque(tagNames, i, subTaskName); LONGS.setOpaque(nanoTimes, i, nanoTime); LONGS.setOpaque(genOps, i, gen + STOP_S_OP); IDX.setRelease(this, localIdx + 1); VarHandle.storeStoreFence(); }
Example 13
Source File: VarHandleMarkHolder.java From perfmark with Apache License 2.0 | 5 votes |
@Override public void stop(long gen, String taskName, long nanoTime) { long localIdx = (long) IDX.get(this); int i = (int) (localIdx & maxEventsMax); STRINGS.setOpaque(taskNames, i, taskName); LONGS.setOpaque(nanoTimes, i, nanoTime); LONGS.setOpaque(genOps, i, gen + STOP_OP); IDX.setRelease(this, localIdx + 1); VarHandle.storeStoreFence(); }
Example 14
Source File: VarHandleMarkHolder.java From perfmark with Apache License 2.0 | 5 votes |
@Override public void stop(long gen, String taskName, String tagName, long tagId, long nanoTime) { long localIdx = (long) IDX.get(this); int i = (int) (localIdx & maxEventsMax); STRINGS.setOpaque(taskNames, i, taskName); STRINGS.setOpaque(tagNames, i, tagName); LONGS.setOpaque(tagIds, i, tagId); LONGS.setOpaque(nanoTimes, i, nanoTime); LONGS.setOpaque(genOps, i, gen + STOP_T_OP); IDX.setRelease(this, localIdx + 1); VarHandle.storeStoreFence(); }
Example 15
Source File: VarHandleMarkHolder.java From perfmark with Apache License 2.0 | 5 votes |
@Override public void link(long gen, long linkId) { long localIdx = (long) IDX.get(this); int i = (int) (localIdx & maxEventsMax); LONGS.setOpaque(tagIds, i, linkId); LONGS.setOpaque(genOps, i, gen + LINK_OP); IDX.setRelease(this, localIdx + 1); VarHandle.storeStoreFence(); }
Example 16
Source File: VarHandleMarkHolder.java From perfmark with Apache License 2.0 | 5 votes |
@Override public void start(long gen, String taskName, String subTaskName, long nanoTime) { long localIdx = (long) IDX.get(this); int i = (int) (localIdx & maxEventsMax); STRINGS.setOpaque(taskNames, i, taskName); STRINGS.setOpaque(tagNames, i, subTaskName); LONGS.setOpaque(nanoTimes, i, nanoTime); LONGS.setOpaque(genOps, i, gen + START_S_OP); IDX.setRelease(this, localIdx + 1); VarHandle.storeStoreFence(); }
Example 17
Source File: VarHandleMarkHolder.java From perfmark with Apache License 2.0 | 5 votes |
@Override public void start(long gen, String taskName, long nanoTime) { long localIdx = (long) IDX.get(this); int i = (int) (localIdx & maxEventsMax); STRINGS.setOpaque(taskNames, i, taskName); LONGS.setOpaque(nanoTimes, i, nanoTime); LONGS.setOpaque(genOps, i, gen + START_OP); IDX.setRelease(this, localIdx + 1); VarHandle.storeStoreFence(); }
Example 18
Source File: VarHandlerTest.java From Concurnas with MIT License | 3 votes |
public static String doIt() throws NoSuchFieldException, IllegalAccessException { VarHandle.storeStoreFence(); MethodHandles.Lookup l = MethodHandles.lookup(); VarHandle VALUE = l.findVarHandle(VarHandlerTest.class, "value", int.class); VarHandlerTest vht = new VarHandlerTest(); int somting = (int) VALUE.getAndSet(vht, 16); return "ok: " + somting; }