596 } |
596 } |
597 |
597 |
598 |
598 |
599 #ifndef AARCH64 |
599 #ifndef AARCH64 |
600 |
600 |
601 typedef jlong cmpxchg_long_func_t(jlong, jlong, volatile jlong*); |
601 typedef int64_t cmpxchg_long_func_t(int64_t, int64_t, volatile int64_t*); |
602 |
602 |
603 cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap; |
603 cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap; |
604 |
604 |
605 jlong os::atomic_cmpxchg_long_bootstrap(jlong compare_value, jlong exchange_value, volatile jlong* dest) { |
605 int64_t os::atomic_cmpxchg_long_bootstrap(int64_t compare_value, int64_t exchange_value, volatile int64_t* dest) { |
606 // try to use the stub: |
606 // try to use the stub: |
607 cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry()); |
607 cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry()); |
608 |
608 |
609 if (func != NULL) { |
609 if (func != NULL) { |
610 os::atomic_cmpxchg_long_func = func; |
610 os::atomic_cmpxchg_long_func = func; |
611 return (*func)(compare_value, exchange_value, dest); |
611 return (*func)(compare_value, exchange_value, dest); |
612 } |
612 } |
613 assert(Threads::number_of_threads() == 0, "for bootstrap only"); |
613 assert(Threads::number_of_threads() == 0, "for bootstrap only"); |
614 |
614 |
615 jlong old_value = *dest; |
615 int64_t old_value = *dest; |
616 if (old_value == compare_value) |
616 if (old_value == compare_value) |
617 *dest = exchange_value; |
617 *dest = exchange_value; |
618 return old_value; |
618 return old_value; |
619 } |
619 } |
620 typedef jlong load_long_func_t(const volatile jlong*); |
620 typedef int64_t load_long_func_t(const volatile int64_t*); |
621 |
621 |
622 load_long_func_t* os::atomic_load_long_func = os::atomic_load_long_bootstrap; |
622 load_long_func_t* os::atomic_load_long_func = os::atomic_load_long_bootstrap; |
623 |
623 |
624 jlong os::atomic_load_long_bootstrap(const volatile jlong* src) { |
624 int64_t os::atomic_load_long_bootstrap(const volatile int64_t* src) { |
625 // try to use the stub: |
625 // try to use the stub: |
626 load_long_func_t* func = CAST_TO_FN_PTR(load_long_func_t*, StubRoutines::atomic_load_long_entry()); |
626 load_long_func_t* func = CAST_TO_FN_PTR(load_long_func_t*, StubRoutines::atomic_load_long_entry()); |
627 |
627 |
628 if (func != NULL) { |
628 if (func != NULL) { |
629 os::atomic_load_long_func = func; |
629 os::atomic_load_long_func = func; |
630 return (*func)(src); |
630 return (*func)(src); |
631 } |
631 } |
632 assert(Threads::number_of_threads() == 0, "for bootstrap only"); |
632 assert(Threads::number_of_threads() == 0, "for bootstrap only"); |
633 |
633 |
634 jlong old_value = *src; |
634 int64_t old_value = *src; |
635 return old_value; |
635 return old_value; |
636 } |
636 } |
637 |
637 |
638 typedef void store_long_func_t(jlong, volatile jlong*); |
638 typedef void store_long_func_t(int64_t, volatile int64_t*); |
639 |
639 |
640 store_long_func_t* os::atomic_store_long_func = os::atomic_store_long_bootstrap; |
640 store_long_func_t* os::atomic_store_long_func = os::atomic_store_long_bootstrap; |
641 |
641 |
642 void os::atomic_store_long_bootstrap(jlong val, volatile jlong* dest) { |
642 void os::atomic_store_long_bootstrap(int64_t val, volatile int64_t* dest) { |
643 // try to use the stub: |
643 // try to use the stub: |
644 store_long_func_t* func = CAST_TO_FN_PTR(store_long_func_t*, StubRoutines::atomic_store_long_entry()); |
644 store_long_func_t* func = CAST_TO_FN_PTR(store_long_func_t*, StubRoutines::atomic_store_long_entry()); |
645 |
645 |
646 if (func != NULL) { |
646 if (func != NULL) { |
647 os::atomic_store_long_func = func; |
647 os::atomic_store_long_func = func; |
650 assert(Threads::number_of_threads() == 0, "for bootstrap only"); |
650 assert(Threads::number_of_threads() == 0, "for bootstrap only"); |
651 |
651 |
652 *dest = val; |
652 *dest = val; |
653 } |
653 } |
654 |
654 |
655 typedef jint atomic_add_func_t(jint add_value, volatile jint *dest); |
655 typedef int32_t atomic_add_func_t(int32_t add_value, volatile int32_t *dest); |
656 |
656 |
657 atomic_add_func_t * os::atomic_add_func = os::atomic_add_bootstrap; |
657 atomic_add_func_t * os::atomic_add_func = os::atomic_add_bootstrap; |
658 |
658 |
659 jint os::atomic_add_bootstrap(jint add_value, volatile jint *dest) { |
659 int32_t os::atomic_add_bootstrap(int32_t add_value, volatile int32_t *dest) { |
660 atomic_add_func_t * func = CAST_TO_FN_PTR(atomic_add_func_t*, |
660 atomic_add_func_t * func = CAST_TO_FN_PTR(atomic_add_func_t*, |
661 StubRoutines::atomic_add_entry()); |
661 StubRoutines::atomic_add_entry()); |
662 if (func != NULL) { |
662 if (func != NULL) { |
663 os::atomic_add_func = func; |
663 os::atomic_add_func = func; |
664 return (*func)(add_value, dest); |
664 return (*func)(add_value, dest); |
665 } |
665 } |
666 |
666 |
667 jint old_value = *dest; |
667 int32_t old_value = *dest; |
668 *dest = old_value + add_value; |
668 *dest = old_value + add_value; |
669 return (old_value + add_value); |
669 return (old_value + add_value); |
670 } |
670 } |
671 |
671 |
672 typedef jint atomic_xchg_func_t(jint exchange_value, volatile jint *dest); |
672 typedef int32_t atomic_xchg_func_t(int32_t exchange_value, volatile int32_t *dest); |
673 |
673 |
674 atomic_xchg_func_t * os::atomic_xchg_func = os::atomic_xchg_bootstrap; |
674 atomic_xchg_func_t * os::atomic_xchg_func = os::atomic_xchg_bootstrap; |
675 |
675 |
676 jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint *dest) { |
676 int32_t os::atomic_xchg_bootstrap(int32_t exchange_value, volatile int32_t *dest) { |
677 atomic_xchg_func_t * func = CAST_TO_FN_PTR(atomic_xchg_func_t*, |
677 atomic_xchg_func_t * func = CAST_TO_FN_PTR(atomic_xchg_func_t*, |
678 StubRoutines::atomic_xchg_entry()); |
678 StubRoutines::atomic_xchg_entry()); |
679 if (func != NULL) { |
679 if (func != NULL) { |
680 os::atomic_xchg_func = func; |
680 os::atomic_xchg_func = func; |
681 return (*func)(exchange_value, dest); |
681 return (*func)(exchange_value, dest); |
682 } |
682 } |
683 |
683 |
684 jint old_value = *dest; |
684 int32_t old_value = *dest; |
685 *dest = exchange_value; |
685 *dest = exchange_value; |
686 return (old_value); |
686 return (old_value); |
687 } |
687 } |
688 |
688 |
689 typedef jint cmpxchg_func_t(jint, jint, volatile jint*); |
689 typedef int32_t cmpxchg_func_t(int32_t, int32_t, volatile int32_t*); |
690 |
690 |
691 cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap; |
691 cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap; |
692 |
692 |
693 jint os::atomic_cmpxchg_bootstrap(jint compare_value, jint exchange_value, volatile jint* dest) { |
693 int32_t os::atomic_cmpxchg_bootstrap(int32_t compare_value, int32_t exchange_value, volatile int32_t* dest) { |
694 // try to use the stub: |
694 // try to use the stub: |
695 cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry()); |
695 cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry()); |
696 |
696 |
697 if (func != NULL) { |
697 if (func != NULL) { |
698 os::atomic_cmpxchg_func = func; |
698 os::atomic_cmpxchg_func = func; |
699 return (*func)(compare_value, exchange_value, dest); |
699 return (*func)(compare_value, exchange_value, dest); |
700 } |
700 } |
701 assert(Threads::number_of_threads() == 0, "for bootstrap only"); |
701 assert(Threads::number_of_threads() == 0, "for bootstrap only"); |
702 |
702 |
703 jint old_value = *dest; |
703 int32_t old_value = *dest; |
704 if (old_value == compare_value) |
704 if (old_value == compare_value) |
705 *dest = exchange_value; |
705 *dest = exchange_value; |
706 return old_value; |
706 return old_value; |
707 } |
707 } |
708 |
708 |