91 assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET)); |
91 assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET)); |
92 assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE)); |
92 assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE)); |
93 assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); |
93 assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); |
94 assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); |
94 assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); |
95 assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); |
95 assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); |
|
96 assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); |
96 assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); |
97 assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); |
97 assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); |
98 assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); |
98 assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); |
99 assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); |
99 |
100 |
100 assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); |
101 assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); |
237 checkROBE(() -> { |
238 checkROBE(() -> { |
238 boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); |
239 boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); |
239 }); |
240 }); |
240 |
241 |
241 checkROBE(() -> { |
242 checkROBE(() -> { |
|
243 boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); |
|
244 }); |
|
245 |
|
246 checkROBE(() -> { |
242 boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2); |
247 boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2); |
243 }); |
248 }); |
244 |
249 |
245 checkROBE(() -> { |
250 checkROBE(() -> { |
246 boolean r = vh.weakCompareAndSetRelease(array, ci, VALUE_1, VALUE_2); |
251 boolean r = vh.weakCompareAndSetRelease(array, ci, VALUE_1, VALUE_2); |
332 checkIOOBE(() -> { |
337 checkIOOBE(() -> { |
333 boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); |
338 boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); |
334 }); |
339 }); |
335 |
340 |
336 checkIOOBE(() -> { |
341 checkIOOBE(() -> { |
|
342 boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); |
|
343 }); |
|
344 |
|
345 checkIOOBE(() -> { |
337 boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2); |
346 boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2); |
338 }); |
347 }); |
339 |
348 |
340 checkIOOBE(() -> { |
349 checkIOOBE(() -> { |
341 boolean r = vh.weakCompareAndSetRelease(array, ci, VALUE_1, VALUE_2); |
350 boolean r = vh.weakCompareAndSetRelease(array, ci, VALUE_1, VALUE_2); |
410 float r = (float) vh.compareAndExchangeRelease(array, ci, VALUE_2, VALUE_1); |
419 float r = (float) vh.compareAndExchangeRelease(array, ci, VALUE_2, VALUE_1); |
411 }); |
420 }); |
412 |
421 |
413 checkIOOBE(() -> { |
422 checkIOOBE(() -> { |
414 boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); |
423 boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); |
|
424 }); |
|
425 |
|
426 checkIOOBE(() -> { |
|
427 boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); |
415 }); |
428 }); |
416 |
429 |
417 checkIOOBE(() -> { |
430 checkIOOBE(() -> { |
418 boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2); |
431 boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2); |
419 }); |
432 }); |
485 checkISE(() -> { |
498 checkISE(() -> { |
486 boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); |
499 boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); |
487 }); |
500 }); |
488 |
501 |
489 checkISE(() -> { |
502 checkISE(() -> { |
|
503 boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); |
|
504 }); |
|
505 |
|
506 checkISE(() -> { |
490 boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2); |
507 boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2); |
491 }); |
508 }); |
492 |
509 |
493 checkISE(() -> { |
510 checkISE(() -> { |
494 boolean r = vh.weakCompareAndSetRelease(array, ci, VALUE_1, VALUE_2); |
511 boolean r = vh.weakCompareAndSetRelease(array, ci, VALUE_1, VALUE_2); |
557 float r = (float) vh.compareAndExchangeRelease(array, ci, VALUE_2, VALUE_1); |
574 float r = (float) vh.compareAndExchangeRelease(array, ci, VALUE_2, VALUE_1); |
558 }); |
575 }); |
559 |
576 |
560 checkISE(() -> { |
577 checkISE(() -> { |
561 boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); |
578 boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); |
|
579 }); |
|
580 |
|
581 checkISE(() -> { |
|
582 boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); |
562 }); |
583 }); |
563 |
584 |
564 checkISE(() -> { |
585 checkISE(() -> { |
565 boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2); |
586 boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2); |
566 }); |
587 }); |
697 assertEquals(r, true, "weakCompareAndSetRelease float"); |
718 assertEquals(r, true, "weakCompareAndSetRelease float"); |
698 float x = (float) vh.get(array, i); |
719 float x = (float) vh.get(array, i); |
699 assertEquals(x, VALUE_2, "weakCompareAndSetRelease float"); |
720 assertEquals(x, VALUE_2, "weakCompareAndSetRelease float"); |
700 } |
721 } |
701 |
722 |
|
723 { |
|
724 boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); |
|
725 assertEquals(r, true, "weakCompareAndSetVolatile float"); |
|
726 float x = (float) vh.get(array, i); |
|
727 assertEquals(x, VALUE_1, "weakCompareAndSetVolatile float value"); |
|
728 } |
|
729 |
702 // Compare set and get |
730 // Compare set and get |
703 { |
731 { |
704 float o = (float) vh.getAndSet(array, i, VALUE_1); |
732 float o = (float) vh.getAndSet(array, i, VALUE_2); |
705 assertEquals(o, VALUE_2, "getAndSet float"); |
733 assertEquals(o, VALUE_1, "getAndSet float"); |
706 float x = (float) vh.get(array, i); |
734 float x = (float) vh.get(array, i); |
707 assertEquals(x, VALUE_1, "getAndSet float value"); |
735 assertEquals(x, VALUE_2, "getAndSet float value"); |
708 } |
736 } |
709 |
737 |
710 } |
738 } |
711 } |
739 } |
712 } |
740 } |
830 assertEquals(r, true, "weakCompareAndSetRelease float"); |
858 assertEquals(r, true, "weakCompareAndSetRelease float"); |
831 float x = (float) vh.get(array, i); |
859 float x = (float) vh.get(array, i); |
832 assertEquals(x, VALUE_2, "weakCompareAndSetRelease float"); |
860 assertEquals(x, VALUE_2, "weakCompareAndSetRelease float"); |
833 } |
861 } |
834 |
862 |
|
863 { |
|
864 boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); |
|
865 assertEquals(r, true, "weakCompareAndSetVolatile float"); |
|
866 float x = (float) vh.get(array, i); |
|
867 assertEquals(x, VALUE_1, "weakCompareAndSetVolatile float value"); |
|
868 } |
|
869 |
835 // Compare set and get |
870 // Compare set and get |
836 { |
871 { |
837 float o = (float) vh.getAndSet(array, i, VALUE_1); |
872 float o = (float) vh.getAndSet(array, i, VALUE_2); |
838 assertEquals(o, VALUE_2, "getAndSet float"); |
873 assertEquals(o, VALUE_1, "getAndSet float"); |
839 float x = (float) vh.get(array, i); |
874 float x = (float) vh.get(array, i); |
840 assertEquals(x, VALUE_1, "getAndSet float value"); |
875 assertEquals(x, VALUE_2, "getAndSet float value"); |
841 } |
876 } |
842 |
877 |
843 } |
878 } |
844 } |
879 } |
845 } |
880 } |