750 // This class adds implied decorators that follow according to decorator rules.
751 // For example adding default reference strength and default memory ordering
752 // semantics.
753 template <DecoratorSet input_decorators>
754 struct DecoratorFixup: AllStatic {
755 // If no reference strength has been picked, then strong will be picked
756 static const DecoratorSet ref_strength_default = input_decorators |
757 (((ON_DECORATOR_MASK & input_decorators) == 0 && (INTERNAL_VALUE_IS_OOP & input_decorators) != 0) ?
758 ON_STRONG_OOP_REF : INTERNAL_EMPTY);
759 // If no memory ordering has been picked, unordered will be picked
760 static const DecoratorSet memory_ordering_default = ref_strength_default |
761 ((MO_DECORATOR_MASK & ref_strength_default) == 0 ? MO_UNORDERED : INTERNAL_EMPTY);
762 // If no barrier strength has been picked, normal will be used
763 static const DecoratorSet barrier_strength_default = memory_ordering_default |
764 ((AS_DECORATOR_MASK & memory_ordering_default) == 0 ? AS_NORMAL : INTERNAL_EMPTY);
765 // Heap array accesses imply it is a heap access
766 static const DecoratorSet heap_array_is_in_heap = barrier_strength_default |
767 ((IN_HEAP_ARRAY & barrier_strength_default) != 0 ? IN_HEAP : INTERNAL_EMPTY);
768 static const DecoratorSet conc_root_is_root = heap_array_is_in_heap |
769 ((IN_CONCURRENT_ROOT & heap_array_is_in_heap) != 0 ? IN_ROOT : INTERNAL_EMPTY);
770 static const DecoratorSet value = conc_root_is_root | BT_BUILDTIME_DECORATORS;
771 };
772
773 // Step 2: Reduce types.
774 // Enforce that for non-oop types, T and P have to be strictly the same.
775 // P is the type of the address and T is the type of the values.
776 // As for oop types, it is allow to send T in {narrowOop, oop} and
777 // P in {narrowOop, oop, HeapWord*}. The following rules apply according to
778 // the subsequent table. (columns are P, rows are T)
779 // | | HeapWord | oop | narrowOop |
780 // | oop | rt-comp | hw-none | hw-comp |
781 // | narrowOop | x | x | hw-none |
782 //
783 // x means not allowed
784 // rt-comp means it must be checked at runtime whether the oop is compressed.
785 // hw-none means it is statically known the oop will not be compressed.
786 // hw-comp means it is statically known the oop will be compressed.
787
788 template <DecoratorSet decorators, typename T>
789 inline void store_reduce_types(T* addr, T value) {
790 PreRuntimeDispatch::store<decorators>(addr, value);
1020 STATIC_ASSERT(ref_strength_decorators == 0 || ( // make sure ref strength decorators are disjoint if set
1021 (ref_strength_decorators ^ ON_STRONG_OOP_REF) == 0 ||
1022 (ref_strength_decorators ^ ON_WEAK_OOP_REF) == 0 ||
1023 (ref_strength_decorators ^ ON_PHANTOM_OOP_REF) == 0 ||
1024 (ref_strength_decorators ^ ON_UNKNOWN_OOP_REF) == 0
1025 ));
1026 const DecoratorSet memory_ordering_decorators = decorators & MO_DECORATOR_MASK;
1027 STATIC_ASSERT(memory_ordering_decorators == 0 || ( // make sure memory ordering decorators are disjoint if set
1028 (memory_ordering_decorators ^ MO_UNORDERED) == 0 ||
1029 (memory_ordering_decorators ^ MO_VOLATILE) == 0 ||
1030 (memory_ordering_decorators ^ MO_RELAXED) == 0 ||
1031 (memory_ordering_decorators ^ MO_ACQUIRE) == 0 ||
1032 (memory_ordering_decorators ^ MO_RELEASE) == 0 ||
1033 (memory_ordering_decorators ^ MO_SEQ_CST) == 0
1034 ));
1035 const DecoratorSet location_decorators = decorators & IN_DECORATOR_MASK;
1036 STATIC_ASSERT(location_decorators == 0 || ( // make sure location decorators are disjoint if set
1037 (location_decorators ^ IN_ROOT) == 0 ||
1038 (location_decorators ^ IN_HEAP) == 0 ||
1039 (location_decorators ^ (IN_HEAP | IN_HEAP_ARRAY)) == 0 ||
1040 (location_decorators ^ (IN_ROOT | IN_CONCURRENT_ROOT)) == 0
1041 ));
1042 }
1043
1044 #endif // SHARE_VM_RUNTIME_ACCESS_INLINE_HPP
|
750 // This class adds implied decorators that follow according to decorator rules.
751 // For example adding default reference strength and default memory ordering
752 // semantics.
753 template <DecoratorSet input_decorators>
754 struct DecoratorFixup: AllStatic {
755 // If no reference strength has been picked, then strong will be picked
756 static const DecoratorSet ref_strength_default = input_decorators |
757 (((ON_DECORATOR_MASK & input_decorators) == 0 && (INTERNAL_VALUE_IS_OOP & input_decorators) != 0) ?
758 ON_STRONG_OOP_REF : INTERNAL_EMPTY);
759 // If no memory ordering has been picked, unordered will be picked
760 static const DecoratorSet memory_ordering_default = ref_strength_default |
761 ((MO_DECORATOR_MASK & ref_strength_default) == 0 ? MO_UNORDERED : INTERNAL_EMPTY);
762 // If no barrier strength has been picked, normal will be used
763 static const DecoratorSet barrier_strength_default = memory_ordering_default |
764 ((AS_DECORATOR_MASK & memory_ordering_default) == 0 ? AS_NORMAL : INTERNAL_EMPTY);
765 // Heap array accesses imply it is a heap access
766 static const DecoratorSet heap_array_is_in_heap = barrier_strength_default |
767 ((IN_HEAP_ARRAY & barrier_strength_default) != 0 ? IN_HEAP : INTERNAL_EMPTY);
768 static const DecoratorSet conc_root_is_root = heap_array_is_in_heap |
769 ((IN_CONCURRENT_ROOT & heap_array_is_in_heap) != 0 ? IN_ROOT : INTERNAL_EMPTY);
770 static const DecoratorSet archive_root_is_root = conc_root_is_root |
771 ((IN_ARCHIVE_ROOT & conc_root_is_root) != 0 ? IN_ROOT : INTERNAL_EMPTY);
772 static const DecoratorSet value = archive_root_is_root | BT_BUILDTIME_DECORATORS;
773 };
774
775 // Step 2: Reduce types.
776 // Enforce that for non-oop types, T and P have to be strictly the same.
777 // P is the type of the address and T is the type of the values.
778 // As for oop types, it is allow to send T in {narrowOop, oop} and
779 // P in {narrowOop, oop, HeapWord*}. The following rules apply according to
780 // the subsequent table. (columns are P, rows are T)
781 // | | HeapWord | oop | narrowOop |
782 // | oop | rt-comp | hw-none | hw-comp |
783 // | narrowOop | x | x | hw-none |
784 //
785 // x means not allowed
786 // rt-comp means it must be checked at runtime whether the oop is compressed.
787 // hw-none means it is statically known the oop will not be compressed.
788 // hw-comp means it is statically known the oop will be compressed.
789
790 template <DecoratorSet decorators, typename T>
791 inline void store_reduce_types(T* addr, T value) {
792 PreRuntimeDispatch::store<decorators>(addr, value);
1022 STATIC_ASSERT(ref_strength_decorators == 0 || ( // make sure ref strength decorators are disjoint if set
1023 (ref_strength_decorators ^ ON_STRONG_OOP_REF) == 0 ||
1024 (ref_strength_decorators ^ ON_WEAK_OOP_REF) == 0 ||
1025 (ref_strength_decorators ^ ON_PHANTOM_OOP_REF) == 0 ||
1026 (ref_strength_decorators ^ ON_UNKNOWN_OOP_REF) == 0
1027 ));
1028 const DecoratorSet memory_ordering_decorators = decorators & MO_DECORATOR_MASK;
1029 STATIC_ASSERT(memory_ordering_decorators == 0 || ( // make sure memory ordering decorators are disjoint if set
1030 (memory_ordering_decorators ^ MO_UNORDERED) == 0 ||
1031 (memory_ordering_decorators ^ MO_VOLATILE) == 0 ||
1032 (memory_ordering_decorators ^ MO_RELAXED) == 0 ||
1033 (memory_ordering_decorators ^ MO_ACQUIRE) == 0 ||
1034 (memory_ordering_decorators ^ MO_RELEASE) == 0 ||
1035 (memory_ordering_decorators ^ MO_SEQ_CST) == 0
1036 ));
1037 const DecoratorSet location_decorators = decorators & IN_DECORATOR_MASK;
1038 STATIC_ASSERT(location_decorators == 0 || ( // make sure location decorators are disjoint if set
1039 (location_decorators ^ IN_ROOT) == 0 ||
1040 (location_decorators ^ IN_HEAP) == 0 ||
1041 (location_decorators ^ (IN_HEAP | IN_HEAP_ARRAY)) == 0 ||
1042 (location_decorators ^ (IN_ROOT | IN_CONCURRENT_ROOT)) == 0 ||
1043 (location_decorators ^ (IN_ROOT | IN_ARCHIVE_ROOT)) == 0
1044 ));
1045 }
1046
1047 #endif // SHARE_VM_RUNTIME_ACCESS_INLINE_HPP
|