< prev index next >

test/hotspot/jtreg/compiler/gcbarriers/UnsafeIntrinsicsTest.java

Print this page

        

*** 272,328 **** return (Node) UNSAFE.getAndSetObject(startNode, offset, head); } private Node mergeImplCAS(Node startNode, Node expectedNext, Node head) { // CAS - should always be true within a single thread - no other thread can have overwritten ! if (!UNSAFE.compareAndSwapObject(startNode, offset, expectedNext, head)) { throw new Error("CAS should always succeed on thread local objects, check you barrier implementation"); } return expectedNext; // continue on old circle } private Node mergeImplCASFail(Node startNode, Node expectedNext, Node head) { // Force a fail ! if (UNSAFE.compareAndSwapObject(startNode, offset, "fail", head)) { throw new Error("This CAS should always fail, check you barrier implementation"); } if (startNode.next() != expectedNext) { throw new Error("Shouldn't have changed"); } return current; } private Node mergeImplWeakCAS(Node startNode, Node expectedNext, Node head) { // Weak CAS - should always be true within a single thread - no other thread can have overwritten ! if (!UNSAFE.weakCompareAndSwapObject(startNode, offset, expectedNext, head)) { throw new Error("Weak CAS should always succeed on thread local objects, check you barrier implementation"); } return expectedNext; // continue on old circle } private Node mergeImplWeakCASFail(Node startNode, Node expectedNext, Node head) { // Force a fail ! if (UNSAFE.weakCompareAndSwapObject(startNode, offset, "fail", head)) { throw new Error("This weak CAS should always fail, check you barrier implementation"); } if (startNode.next() != expectedNext) { throw new Error("Shouldn't have changed"); } return current; } private Node mergeImplCMPX(Node startNode, Node expectedNext, Node head) { // CmpX - should always be true within a single thread - no other thread can have overwritten ! Object res = UNSAFE.compareAndExchangeObjectVolatile(startNode, offset, expectedNext, head); if (!res.equals(expectedNext)) { throw new Error("Fail CmpX should always succeed on thread local objects, check you barrier implementation"); } return expectedNext; // continue on old circle } private Node mergeImplCMPXFail(Node startNode, Node expectedNext, Node head) { ! Object res = UNSAFE.compareAndExchangeObjectVolatile(startNode, offset, head, head); if (startNode.next() != expectedNext) { throw new Error("Shouldn't have changed"); } if (head == expectedNext) { throw new Error("Test malfunction"); --- 272,328 ---- return (Node) UNSAFE.getAndSetObject(startNode, offset, head); } private Node mergeImplCAS(Node startNode, Node expectedNext, Node head) { // CAS - should always be true within a single thread - no other thread can have overwritten ! if (!UNSAFE.compareAndSetObject(startNode, offset, expectedNext, head)) { throw new Error("CAS should always succeed on thread local objects, check you barrier implementation"); } return expectedNext; // continue on old circle } private Node mergeImplCASFail(Node startNode, Node expectedNext, Node head) { // Force a fail ! if (UNSAFE.compareAndSetObject(startNode, offset, "fail", head)) { throw new Error("This CAS should always fail, check you barrier implementation"); } if (startNode.next() != expectedNext) { throw new Error("Shouldn't have changed"); } return current; } private Node mergeImplWeakCAS(Node startNode, Node expectedNext, Node head) { // Weak CAS - should always be true within a single thread - no other thread can have overwritten ! if (!UNSAFE.weakCompareAndSetObject(startNode, offset, expectedNext, head)) { throw new Error("Weak CAS should always succeed on thread local objects, check you barrier implementation"); } return expectedNext; // continue on old circle } private Node mergeImplWeakCASFail(Node startNode, Node expectedNext, Node head) { // Force a fail ! if (UNSAFE.weakCompareAndSetObject(startNode, offset, "fail", head)) { throw new Error("This weak CAS should always fail, check you barrier implementation"); } if (startNode.next() != expectedNext) { throw new Error("Shouldn't have changed"); } return current; } private Node mergeImplCMPX(Node startNode, Node expectedNext, Node head) { // CmpX - should always be true within a single thread - no other thread can have overwritten ! Object res = UNSAFE.compareAndExchangeObject(startNode, offset, expectedNext, head); if (!res.equals(expectedNext)) { throw new Error("Fail CmpX should always succeed on thread local objects, check you barrier implementation"); } return expectedNext; // continue on old circle } private Node mergeImplCMPXFail(Node startNode, Node expectedNext, Node head) { ! Object res = UNSAFE.compareAndExchangeObject(startNode, offset, head, head); if (startNode.next() != expectedNext) { throw new Error("Shouldn't have changed"); } if (head == expectedNext) { throw new Error("Test malfunction");
< prev index next >